package com.hm.hall.commons.constans;

import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 可信ip
 *
 * @author wei
 */
public class WhitelistIP {

    private static List<String> IPLIST = new ArrayList<String>();

    static {
        IPLIST.add("192.168.1.201");
        IPLIST.add("192.168.1.101"); //luhong
        IPLIST.add("10.160.30.225");//4he
        IPLIST.add("10.160.30.225:8082");//4he
        IPLIST.add("112.124.30.67");//4he
        IPLIST.add("10.132.29.243");//boss
        IPLIST.add("121.199.49.198");//boss
        IPLIST.add("10.168.240.75");//deal
        IPLIST.add("121.41.114.45");//deal
    }

    /**
     * 判断是否白名单ip
     *
     * @param ip
     * @return ture为白名单
     */
    public static boolean isWhitelist(String ip) {
        if (StringUtils.isEmpty(ip)) {
            return false;
        } else {
            if (IPLIST.contains(ip)) {
                return true;
            } else {
                return false;
            }
        }
    }
}

